<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title>已关闭服务</title>
		<!-- css代码 start -->
		<link href="../../../css/mui.min.css" rel="stylesheet" />
		<link href="../../../css/global.css" rel="stylesheet" />
		<link href="../../../css/style.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../../css/mui.picker.css">
		<link rel="stylesheet" href="../../../css/mui.poppicker.css">
		<link rel="stylesheet" href="../../../css/task.css">
		<style>
			.d_int_tp{
				border: 0 !important;
				margin-top: 6px !important;
			}
			.details_con .btm .selectBtn {
				line-height: 28px;
				color: #ffffff;
				background: #ea1e1a;
			}
			
			.item_box .item .text{
				margin: 5px auto;
			}
			.item_box .item .text span.cen{
				margin-left:0;
			}
			.item_box .item .text span{
				width: auto;
			}
			
			.select-tzstate{
				width: 100%;
				border: 0;
				color: #a9a9a9;
				font-size: 16px;
				text-align: left;
				padding: 15px;
			}
			
			.mui-bar-nav{
				box-shadow: 0 1px 6px #ea1e1a;
			}
		</style>
		<!-- css代码 end -->
	</head>

	<body>
		<!-- html代码 start -->
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">已关闭服务</h1>
		</header>
		<div class="mui-content">
			
			<div class="details_con select_con" id="search">
				<div class="clum">
					<input type="text" class="d_int_tp" id="customerName" placeholder="输入客户名称" />
				</div>
				<div class="clum">
					<!-- <input type="text" class="d_int_tp" id="serviceType" placeholder="输入服务类型" /> -->
					<span class="txt" style="width: 100%;">
						<input type="hidden" id="serviceTypeValue" />
						<button id='serviceType' class="mui-btn mui-btn-block mui-btn-select select-tzstate" type='button'>请选择服务子类型</button>
					</span>
				</div>
				<div class="clum">
					<input type="text" class="d_int_tp" id="instrumentSerialNumber" placeholder="输入仪器序列号" />
				</div>
				<div class="btm autoHeight">
					<p class="selectBtn" id="searchBtn" onclick="initData()">查 询</p>
				</div>
			</div>
			
			<div class="details_con" style="margin: 30px 0 0 0;">
				<div class="item_box" id="itemBox">
				</div>
			</div>
			<div style="height: 50px;"></div>
		</div>
		<!-- html代码 end -->
		
		<!-- js代码 start -->
		
		<!-- 基础js start -->
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/utils/h.js"></script>
		<script src="../../../js/constant.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/utils/base64.js"></script>
		<script src="../../../js/utils/md5.js"></script>
		<script src="../../../js/utils/sortMap.js"></script>
		<script src="../../../js/utils/http.js"></script>
		<script src="../../../js/app.js"></script>
		<!-- 基础js end -->
		<script src="../../../js/mui.picker.js"></script>
		<script src="../../../js/mui.poppicker.js"></script>
		<script type="text/javascript" charset="utf-8">
			(function($, doc) {
				$.init();
		
				$.plusReady(function() {
					var self = plus.webview.currentWebview();
					initData()	
					
					// 服务子类型下拉
					h('#serviceType').tap(function() {
						var userPicker = new $.PopPicker();
						ajaxGetJson(BASE_URL + 'cc/dict/selectCCDict', {
							tableName: 'snsubtype',
							engineerId: app.getUser().enginnerId
						}, function(data) {
							console.log(JSON.stringify(data))
							if (!data) {
								app.toast("无下拉内容")
								return
							}
							// 数组指定位置插入数据
							data.splice(0, 0, {"text":"请选择服务子类型","value":""});
							userPicker.setData(data);
							userPicker.show(function(items) {
								h('#serviceType').html(items[0].text)
								h('#serviceTypeValue').val(items[0].value)
								userPicker.dispose()
							});
						});
					});
					
					h('.mui-action-back').tap(function () {
						var noticeMenu=plus.webview.getWebviewById('view/service/notice/noticeMenu.html');
						if(noticeMenu){
							noticeMenu.evalJS('getNoticeCount()')
						}
					});
				});
			}(mui, document));
			
			function initData(){
				
				app.showWaiting('加载中...')
				var customerName = h("#customerName").val();
				var serviceType = h("#serviceType").html();
				if(serviceType=='请选择服务子类型'){
					serviceType = ""
				}
				var instrumentSerialNumber = h("#instrumentSerialNumber").val();
				
				ajaxGet(BASE_URL + "cc/notice/getClosedNoticeList", {
					"EnginnerId": app.getUser().enginnerId,
					"AppState": 3,
					"customerName": customerName,
					"serviceType": serviceType,
					"instrumentSerialNumber": instrumentSerialNumber
				}, function(data) {
					app.closeWaiting()
					console.log(JSON.stringify(data))
					if (data.code === 200) {
						var str = '';
						if (data.data && data.data.length > 0) {
							 for(var c = 0;c<data.data.length;c++){
								 
								 var xianshi = '';
								 var enginnerType = data.data[c].enginnerType?data.data[c].enginnerType:"";
								 var isVip = data.data[c].isVip?data.data[c].isVip:"";
								 var userIsdpel = data.data[c].userIsdpel?data.data[c].userIsdpel:"";
								 if(userIsdpel=='1'){
								 	xianshi = 'DPEL/'
								 }
								 if(isVip!=''){
								 	xianshi += isVip
								 }else{
								 	if(enginnerType!=''){
								 		xianshi += enginnerType
								 	}
								 }
								 
								 // str += '<div class="item" onclick="tiaozhuan(\''+data.data[c].serviceNo+'\')">';
								 // str += '<div class="type">';
								 // str += '<p>服务通知编号：<span>'+data.data[c].serviceNo+'</span></p> ';
								 // str += '<p>提交时间：<span>'+data.data[c].createTime+'</span></p>';
								 // str += '<p>客户名称：<span>'+data.data[c].customerName+'</span></p>';
								 // str += '<p>服务子类型：<span>'+data.data[c].subServiceType+'</span></p>';
								 // str += '</div></div>';
								 var customerName = data.data[c].customerName ? data.data[c].customerName : "";
								 var createTime = data.data[c].createTime ? data.data[c].createTime : "";
								 var serviceType = data.data[c].subServiceType ? data.data[c].subServiceType : "";
								 str += '<div class="item" onclick="tiaozhuan(\''+data.data[c].serviceNo+'\')">';
								 str += '<div class="bar">';
								 str += '<span class="number"><img src="../../../images/icon_204.png" />'+data.data[c].serviceNo+'</span>';		
								
									 str += '<span class="vip">'+xianshi+'</span>';
								
								 str += '</div>';
								 str += '<div class="text autoHeight">';
								 str += '<span class="cen" style="color: #333;">'+customerName+'</span>';
								 str += '</div>';
								 str += '<div class="type">';
								 str += '<p><img src="../../../images/icon_202.png"/><span class="lpl">提交时间：</span><span>'+createTime+'</span></p>';
								 str += '<p><img src="../../../images/icon_203.png"/><span class="lpl">服务子类型：</span><span>'+serviceType+'</span></p>';
								 str += '</div>';
								 str += '</div>';
							 }
							 h('#itemBox').html(str);
						}else{
							var html = '<div class="nodata">—— 暂无数据 ——</div>';
							h("#itemBox").html(html);
						}
					} else {
						var html = '<div class="nodata">—— 暂无数据 ——</div>';
						h("#itemBox").html(html);
						app.toast(data.msg);
					}
				}, function(errorMsg) {
					app.closeWaiting();
					var html = '<div class="nodata">—— 暂无数据 ——</div>';
					h("#itemBox").html(html);
					app.toast("数据获取失败，请检查网络连接");
				});
			}
			
			function tiaozhuan(serviceNo){
				app.jumpTo("/view/service/notice/customerReportList.html", "view/service/notice/customerReportList.html", {
					serviceNo: serviceNo,
					prev: "closedList"
				});
			}
			// 跳转详情
			function jumpToDetail(serviceNo) {
				app.jumpTo("/view/workArea/service/serveDetails.html", "view/workArea/service/serveDetails.html", {
					"serviceNo": serviceNo,
					"enginnerId": app.getUser().enginnerId
				})
			}
		</script>
		<!-- js代码 end -->
	</body>

</html>
